import requests
import threading
import json
import logging


def send_web_thread(name, info):
    # send to web
    t = threading.Thread(target=send_web, args=(name, info,))
    t.start()
    t.join()


def send_web(name, info):
    """
    data_info = []
    data1 = {'platform': 'binance', 'eth': '2', 'btc': '1', 'eos': '1.5', 'cyn': '100.1'}
    data2 = {'platform': 'huobi', 'eth': '3', 'btc': '0.8', 'eos': '1.5', 'cyn': '99.1'}
    data_info.append(data1)
    data_info.append(data2)
    """
    try:
        r = requests.post("http://106.15.89.107/" + name, data=json.dumps(info), timeout=1)
        logging.info(r)
    except Exception as e:
        logging.info(e)
